// 新增计划
const {
    DayPlan
} = require('../../../model/plan/dayPlan');


module.exports = async (req, res) => {
    let plan = req.fields;
    Object.keys(plan).forEach(key => {
        if (key === 'startTime' || key === 'endTime') {
            plan[key] = new Date(plan[key]).getTime();
        }
    });

    // 创建计划
    const dayPlan = await DayPlan.create({
        ...plan,
        createTime: new Date().getTime()
    });
    res.send({ 'code': 0 });
}